"""
要素召回的api接口
"""
from typing import Any, Dict
from fastapi import Body
from core.recall import recall
from server.api_wrap import async_api_wrapper, BaseResponse


@async_api_wrapper
async def recall_api(
        fileId: str = Body(description='文件id', examples=['dad6204ebdb84513b3afb175e462b']),
        rule: Dict[str, Any] = Body(description='要素的内容抽取及语义审查', examples=[
            {'id': "123", 'name': "XXX", 'extractHint': "YYY", 'checkHint': "ZZZ"}])
):
    result = await recall(fileId, rule)
    return BaseResponse(data=result)